home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 12 / BBS in a box XII-2.iso / Files II / Prog / D-G / GrafSys2.0rel.sit / GrafSys 2.0 rel / GrafSys 2.0 source / Resources.p < prev    next >
Encoding:
Text File  |  1993-07-21  |  1.5 KB  |  54 lines  |  [TEXT/PJMM]

  1. unit Resources;
  2.  
  3. interface
  4.     uses
  5.         Matrix, Transformations, OffscreenCore, GrafSysCore, GrafSysScreen, GrafSysObject, ResourceAccess;
  6.  
  7. {The resource access procedures are version 1.x compatible }
  8.     function GetNewObject (theObjectID: INTEGER): TSObject3D;        {Create new 3D object and fill with data from res}
  9.     function GetNewNamedObject (theName: Str255): TSObject3D;
  10.     procedure SaveObject (Obj: TSObject3D; theName: Str255; ID: integer);    {save data to resource with number = ID }
  11.     procedure SaveNamedObject (Obj: TSObject3D; theName: Str255; var ID: integer);
  12.  
  13. implementation
  14.  
  15.     function GetNewObject (theObjectID: INTEGER): TSObject3D;
  16.  
  17.         var
  18.             theObject: TSObject3D;
  19.  
  20.     begin
  21.         New(theObject); (* allocate and initialize *)
  22.         theObject.Init;
  23.         LoadObjRes(theObjectID, theObject);
  24.  
  25.         GetNewObject := theObject;
  26.     end;
  27.  
  28.     function GetNewNamedObject (theName: Str255): TSObject3D;
  29.  
  30.         var
  31.             theObject: TSObject3D;
  32.  
  33.     begin
  34.         New(theObject); (* allocate and initialize *)
  35.         theObject.Init;
  36.  
  37.         LoadNamedObjRes(theName, theObject); (* load resource from file *)
  38.         GetNewNamedObject := theObject;
  39.     end;
  40.  
  41. (* SaveObjRes : Save the 3D structure of the object into a '3Dob' resource. Note that         *)
  42. (*                      resources are not identified by ID but by name, so you better pass a name *)
  43.  
  44.     procedure SaveNamedObject (Obj: TSObject3D; theName: Str255; var ID: integer);
  45.  
  46.     begin
  47.         SaveNamedObjRes(ID, theName, Obj);
  48.     end;
  49.  
  50.     procedure SaveObject (Obj: TSObject3D; theName: Str255; ID: integer);    {save data to resource with number = ID }
  51.     begin
  52.         SaveObjRes(ID, theName, Obj);
  53.     end;
  54. end.